<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<html>
<body>

<h1>Java Learning Center</h1>
<h2>Contact Management System</h2>
<logic:equal name="EDIT" scope="session" value="FALSE">

<h2>Search results</h2>
<table>
<tr><td>First Name</td><td>${CTO.fname}</td></tr>
<tr><td>Last Name</td><td>${CTO.lname}</td></tr>
<tr><td>Email ID</td><td>${CTO.email}</td></tr>
<tr><td>Phone No</td><td>${CTO.phone}</td></tr>

</table>

<html:form action="/EditContactSubmit">
<html:submit value="Edit Contact"/>
</html:form>

</logic:equal>

<logic:equal name="EDIT" scope="session" value="TRUE">

<h2>Search results</h2>
<html:form action="/UpdateContactSubmit.do">
<table>

<tr>
<td>First Name</td>
<td><html:text property="fname" value="${CTO.fname}"/></td>
<td><html:errors property="fname"/></td>
</tr>

<tr>
<td>Last Name</td>
<td><html:text property="lname" value="${CTO.lname}"/></td>
<td><html:errors property="lname"/></td>
</tr>

<tr>
<td>Email ID</td>
<td><html:text property="email" value="${CTO.email}"/></td>
<td><html:errors property="email"/></td>
</tr>

<tr>
<td>Phone No</td>
<td><html:text property="phone" value="${CTO.phone}"/></td>
<td><html:errors property="phone"/></td>
</tr>

</table>
<tr><td><html:submit value="Update Contact"/></td></tr>
</html:form>
</logic:equal>
</body>
</html>